package com.shop2cn.iapi.agentproducts.testcase;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.CatalogPropDto;
import com.shop2cn.iapi.agentproducts.parameter.ImportAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ModifyAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ModifyCatalogDto;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsBean;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.shop2cn.iapi.agentproducts.parameter.SaveSelectionConditionBean;
import com.shop2cn.iapi.agentproducts.parameter.SelectProductListDto;
import com.shop2cn.iapi.agentproducts.parameter.SelectionListBean;
import com.shop2cn.iapi.agentproducts.service.SelectionListCall;
import com.shop2cn.iapi.agentproducts.service.SelectionListCallV2;
import com.ymatou.iapi.godmch.parameter.createDepotBean;
import com.ymatou.iapi.godmch.parameter.setConditionMarkupConfigBean;
import com.ymatou.iapi.productsynces.parameter.es.EsGodProduct;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AddAgentProductCallService;
import com.ymttest.business.service.AgentProductCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.database.model.godmch.mch_depot_info;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.utils.AgentUsers;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 * 选货中心 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_SelectionList {
	private static SelectionListBean selectionlistBean;
	private static SelectionListCall selectionlistCall;
	
	// 渠道商
	private static int sellerId = AgentUsers.rootUserId;
	private static String sellerName = "NickautoTest";
	// 渠道商->代理商1
	private static int agentUserId1 = AgentUsers.agentUserId1;
	private static String agentUserName1 = "NickautoTest";
	// 渠道商->代理商2
	private static int agentUserId2 = AgentUsers.agentUserId2;
	private static String agentUserName2 = "NickautoTest";

	// vip渠道
	private static int vipRootUserId = AgentUsers.vipRootUserId;
	private static String vipRootUserName = "NickautoTest";

	private static int vipRootUserId1 = 500019337;
	private static String vipRootUserName1 = "NickautoTest";
	// vip渠道->代理
	private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
	private static String vipAgentUserName1 = "dgsq408897016";
	// vip渠道->代理->代理
	private static int vipAgentUserId2 = AgentUsers.vipAgentUserId2;
	private static String vipAgentUserName2 = "NickautoTest";

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("选货中心");
	}

	@Before
	public void caseUp() {
		selectionlistBean = new SelectionListBean();
		selectionlistCall = new SelectionListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(selectionlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_01() {
		Logger.start(true, "渠道商获取选货中心,获取失败");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId,
					sellerName, false);
			AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(sellerId, sellerId);
			selectionlistBean.setTitle(null);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyEquals(true, selectionlistCall.getProductList().size() == 0, "验证productList");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_02() {
		Logger.start(true, "普通代理商获取选货中心,获取成功");
		try {
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agentUserId1, sellerId);
			selectionlistBean.setTitle("God");
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_03() {
		Logger.start(true, "vip渠道商->vip1->vip2,vip1代理了一部分商品,查看vip2的选货中心，验证vip2中没有vip1没有代理的商品");
		try {
			// 发布商品1
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// 发布商品2
			AddAgentProductBean addAgentProductBean1 = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String productId1 = AddAgentProductCallService.AddAgentProduct(addAgentProductBean1);
			// vip1代理商品1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			// vip2代理商品
			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
			String agentProdquctId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId2, vipRootUserId);
			selectionlistBean.setTitle(addAgentProductBean1.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("500", selectionlistCall.getString("code"), "验证code");

			 
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_04() {
		Logger.start(true, "根据商品标题来获取选货中心,获取成功");
		try {
			// 发布商品1
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.setTitle(TestDataManager.getRandomNum(7));
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip1代理商品1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, false);

			AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			Thread.sleep(5000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle(addAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);
			selectionlistCall.getProductList().forEach(p -> {
				Logger.verifyEquals(true, p.getTitle().contains(selectionlistBean.getTitle()), "验证查找出来的商品中含有title字段");
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_05() {
		Logger.start(true, "根据商品二级类目来获取选货中心,获取成功");
		try {
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle(null);
			selectionlistBean.setSecondCategoryId(1002);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);
			YmtProductsIWapper ymtProductsIWapper = new YmtProductsIWapper();
			selectionlistCall.getProductList().forEach(p -> {
				try {
					YmtProductsI ymtProductsI = ymtProductsIWapper.selectProductByProductId(p.getProductId()).get(0);
					Logger.verifyEquals(true, ymtProductsI.getiCategoryId() == selectionlistBean.getSecondCategoryId(),
							"验证查找出来的商品中的二级类目与传入参数一致");
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			});
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_06() {
		Logger.start(true, "商户id为空，获取失败");
		try {
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(0, vipRootUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("400", selectionlistCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_07() {
		Logger.start(true, "渠道商id为空，获取成功，商品列表是所有上级的商品");
		try {
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, 0);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_09() {
		Logger.start(true, "vip渠道->vip1->vip2，获取vip2的选货中心");
		try {
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId2, vipAgentUserId1);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_08() {
		Logger.start(true, "vip渠道->vip1->vip2，vip渠道修改品牌类目，查看vip1和vip2的品牌类目");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String title = TestDataManager.getRandomNum(7);
			addAgentProductBean.setTitle(title);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String productId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, productId1, vipAgentUserId1, false);
			String productId2 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);

			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);
			modifyAgentProductBean.setBrandId(10065);
			modifyAgentProductBean.setCategoryId(1006);
			modifyAgentProductBean.setThirdCategoryId(1011);
			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			Thread.sleep(2000);
			// 查看vip1
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle(modifyAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);

			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId2, vipRootUserId);
			selectionlistBean.setTitle(importAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos1 = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos1);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_10() {
		Logger.start(true, "vip渠道->vip1，新增规格，未设置代理价，获取商品列表不过滤未设置代理价的规格");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String title = TestDataManager.getRandomNum(7);
			addAgentProductBean.setTitle(title);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			// 新增规格 未设置代理价
			ModifyAgentProductBean modifyAgentProductBean = AddAgentProductCallService
					.initModifyAgentProductBean(productId, addAgentProductBean);
			ModifyCatalogDto modifyCatalogDto = new ModifyCatalogDto();
			modifyCatalogDto.setOperateType(0);
			modifyCatalogDto.setAgentPriceList(null);
			modifyCatalogDto.setSku(addAgentProductBean.getCatalogList().get(0).getSku());
			modifyCatalogDto.setPropertyValue("新增规格：" + TestDataManager.getRandomNum(5));
			modifyCatalogDto.setStock(100);
			modifyCatalogDto.setDirectPrice(100);

			CatalogPropDto catalogPropDto1 = new CatalogPropDto();
			catalogPropDto1.setName("自动化测试1_" + TestDataManager.getRandomNum(5));
			catalogPropDto1
					.setPic("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701.jpg");
			catalogPropDto1.setSubType("de码");
			catalogPropDto1.setValue("179");

			CatalogPropDto catalogPropDto2 = new CatalogPropDto();
			catalogPropDto2.setName("自动化测试2_" + TestDataManager.getRandomNum(5));
			catalogPropDto2
					.setPic("http://pc1.img.ymatou.com/G01/shangou/M00/2C/D0/rBBlD1gHOV6AY32AAAEN6UG5TOc701.jpg");
			catalogPropDto2.setSubType("ying码");
			catalogPropDto2.setValue("184");

			modifyCatalogDto.setPropertyList(Arrays.asList(catalogPropDto1, catalogPropDto2));
			modifyAgentProductBean.getCatalogList().add(modifyCatalogDto);

			AddAgentProductCallService.modifyAgentProduct(modifyAgentProductBean);

			Thread.sleep(2000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle(modifyAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals(3, selectProductListDtos.get(0).getCatalogList().size(), "验证没有新增规格");
			// AgentProductCallService.checkSelectionList(selectionlistBean,selectProductListDtos);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_16() {
		Logger.start(true, "vip渠道->vip1，渠道商未设置代理价，获取商品列表不过滤未设置代理价的规格,代理价取直销价");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, false);
			String title = TestDataManager.getRandomNum(7);
			addAgentProductBean.setTitle(title);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle(title);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals(2, selectProductListDtos.get(0).getCatalogList().size(), "验证没有新增规格");
			// AgentProductCallService.checkSelectionList(selectionlistBean,selectProductListDtos);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_11() {
		Logger.start(true, "vip渠道->vip1，库存为0的规格，获取成功");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String title = TestDataManager.getRandomNum(7);
			addAgentProductBean.setTitle(title);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			YmtCatalogsIWapper ymtCatalogsIWapper = new YmtCatalogsIWapper();
			String catalogId = ymtCatalogsIWapper.selectCatalogsByProductId(productId).get(0).getsCatalogId();
			Logger.debug(catalogId);
			ymtCatalogsIWapper.updatestocknumByCatalogID(0, catalogId);

			Thread.sleep(2000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle(addAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_12() {
		Logger.start(true, "vip渠道->vip1，已导入我的店铺商品，验证exitshop");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String title = TestDataManager.getRandomNum(7);
			addAgentProductBean.setTitle(title);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);

			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			Thread.sleep(2000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle(addAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_13() {
		Logger.start(true, "一个代理商有多个渠道商，获取选货中心");
		try {
			int sellerId = 500019338;
			int sellerId1 = 500019339;
			int agentsellerId = 500019340;
			String name = "NickautoTest";
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(sellerId, name,
					true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			AddAgentProductBean addAgentProductBean1 = AddAgentProductCallService.initAddAgentProduct(sellerId1, name,
					true);
			String productId1 = AddAgentProductCallService.AddAgentProduct(addAgentProductBean1);
			Thread.sleep(2000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agentsellerId, 0);
			selectionlistBean.setTitle(addAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_14() {
		Logger.start(true, "代理商客服查看选货中心,templateId5");
		try {
			int csId = 500028917;
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(csId, 0);
			SelectionListCallV2 selectionListCallV2 = new SelectionListCallV2();
			selectionListCallV2.setData(selectionlistBean);
			selectionListCallV2.addHeader("ymt-pars",
					"accesstoken=FCD279E177169DBCB679B87B96425C7803B41D0A25FD8B897EC8BB361D5EB39B03B373ACE53EF9452E06A8E813D5317F9BA3A808D819FA27");
			selectionListCallV2.callService();
			Logger.verifyEquals(true, selectionListCallV2.getProductList().size() > 0, "验证返回结果有数据");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_15() {
		Logger.start(true, "代理商客服查看选货中心,templateId6,无权限");
		try {
			int csId = 500028918;
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(csId, 0);
			SelectionListCallV2 selectionListCallV2 = new SelectionListCallV2();
			selectionListCallV2.setData(selectionlistBean);
			selectionListCallV2.addHeader("ymt-pars",
					"accesstoken=FCD279E177169DBC07B81F1324B12582E11D0A2C48899B1B96AD63B1159A921BA1FF397A27188E27ECBD6B278EAB12F437EAD6743A323249");
			selectionListCallV2.callService();
			Logger.verifyEquals("201", selectionListCallV2.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_17() {
		Logger.start(true, "vip渠道->vip1->vip2，vip2查看vip1");
		try {
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			String title = TestDataManager.getRandomNum(7);
			addAgentProductBean.setTitle(title);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);

			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
			String productId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);

			// 查看vip1
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId2, vipAgentUserId1);
			selectionlistBean.setTitle(importAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos);

			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId2, vipRootUserId);
			selectionlistBean.setTitle(importAgentProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos1 = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

			AgentProductCallService.checkSelectionList(selectionlistBean, selectProductListDtos1);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_18() {
		Logger.start(true, "渠道商通过es获取");
		try {

			// 发布商品1
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,
					vipRootUserName, true);
			addAgentProductBean.setTitle("t恤女长袖白色纯棉宽松女装内搭打底衫2019新款秋季上衣初秋ins潮");
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			// vip1代理商品1
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService
					.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, false);
			AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			Thread.sleep(5000);

			// 查询es，判断同步
			EsGodProduct esProduct = Ts_GetProductList.checkEsSync(productId);

			// 模糊查询
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle("长袖");
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			// 判断是否查询到了
			Logger.verifyNotEquals(-1, selectProductListDtos.toString().indexOf(esProduct.getPid()), "没有查询到刚刚添加的商品");

			// 打乱词汇进行查询
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipRootUserId);
			selectionlistBean.setTitle("女装内搭打底衫纯棉袖新款秋季白色宽松2019");
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			selectProductListDtos = selectionlistCall.getProductList();

			// 判断是否查询到了
			Logger.verifyNotEquals(-1, selectProductListDtos.toString().indexOf(esProduct.getPid()), "没有查询到刚刚添加的商品");

		} catch (Exception e) {
			Logger.fail(e);
		} finally {
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_19() {
		Logger.start(true, "代理水印开--非继承性代理查询水印");
		try {

				
			int userId_channl=500275675;
			int userId_agent=500275676;
				AddAgentProductBean sellerProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,"666666",true);
				//提交发布商品
				String productId = AddAgentProductCallService.AddAgentProduct(sellerProductBean);
				Thread.sleep(5000); 
				
//				ImportAgentProductBean AgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,"777777",productId,userId_channl,false);
//			
//				String productId1 = AddAgentProductCallService.ImportAgentProduct(AgentProductBean);

			
			Thread.sleep(5000);
			
			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(userId_agent, userId_channl);
			selectionlistBean.setTitle(sellerProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_20() {
		Logger.start(true, "代理水印关--非继承性代理查询水印");
		try {

				
			int userId_channl=500275675;
			int userId_agent=500275676;
				AddAgentProductBean sellerProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,"666666",true);
				//提交发布商品
				String productId = AddAgentProductCallService.AddAgentProduct(sellerProductBean);
				Thread.sleep(5000); 
				
				ImportAgentProductBean AgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,"777777",productId,userId_channl,false);
			
				String productId1 = AddAgentProductCallService.ImportAgentProduct(AgentProductBean);

			
			Thread.sleep(5000);
			


			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(userId_agent, userId_channl);
			selectionlistBean.setTitle(sellerProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_21() {
		Logger.start(true, "无水印图和最后更新时间");
		try {

				
			int userId_channl=500275675;
			int userId_agent=500275676;
				AddAgentProductBean sellerProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,"666666",true);
				//提交发布商品
				String productId = AddAgentProductCallService.AddAgentProduct(sellerProductBean);
				Thread.sleep(5000); 
				
				ImportAgentProductBean AgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,"777777",productId,userId_channl,false);
			
				String productId1 = AddAgentProductCallService.ImportAgentProduct(AgentProductBean);

			
			Thread.sleep(5000);
			


			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(userId_agent, userId_channl);
			selectionlistBean.setTitle(sellerProductBean.getTitle());
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			JsonObject products = selectionlistCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("productList").get(0).getAsJsonObject();
			String updateTime = products.get("updateTime").toString();
			System.out.println(updateTime);
			Logger.verifyNotNull(updateTime, "判断获取到了最后修改时间");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_22() {
		Logger.start(true, "按照时间段查询刚刚添加的商品");
		try {
				
			int userId_channl=500275675;
			int userId_agent=500275676;
				AddAgentProductBean sellerProductBean = AddAgentProductCallService.initAddAgentProduct(userId_channl,"666666",true);
				//提交发布商品
				String productId = AddAgentProductCallService.AddAgentProduct(sellerProductBean);
				Thread.sleep(5000); 
				
				ImportAgentProductBean AgentProductBean = AddAgentProductCallService.initImportAgentProduct(userId_agent,"777777",productId,userId_channl,false);
			
				String productId1 = AddAgentProductCallService.ImportAgentProduct(AgentProductBean);
			
			Thread.sleep(5000);

			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(userId_agent, userId_channl);
//			selectionlistBean.setTitle(sellerProductBean.getTitle());
			selectionlistBean.setStartTime(YMTDateUtil.getBeforeOrNextDay(-1,"yyyy-MM-dd HH:mm:ss"));
			selectionlistBean.setEndTime(YMTDateUtil.getBeforeOrNextDay(1,"yyyy-MM-dd HH:mm:ss"));
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			
			boolean c=false;
			for (SelectProductListDto selectProductListDto : selectProductListDtos) {
				String productId2 = selectProductListDto.getProductId();
				if(productId2.equals(productId)){
					c=true;
				}
			}
			Logger.verifyEquals(true, c, "查询到了刚刚添加的商品");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_23() {
		Logger.start(true, "自动加价状态");
		try {
			int rootUserId = 501475646;
			int agentUserId = 501475647;
			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agentUserId, rootUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			JsonArray asJsonArray = selectionlistCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("productList");
			asJsonArray.forEach(b->{
				Logger.verifyEquals(b.getAsJsonObject().get("autoMarkupStatus").getAsInt(), 1,"有自动加价配置");
			});
			selectProductListDtos.forEach(b->{
				Logger.verifyEquals(b.getAutoMarkupStatus(), 1,"有自动加价配置");
			});
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_24() {
		Logger.start(true, "没有自动加价状态");
		try {  
			int rootUserId = AgentUsers.rootUserId;
			int agentUserId = AgentUsers.agentUserId1;
			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agentUserId, rootUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			JsonArray asJsonArray = selectionlistCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("productList");
			asJsonArray.forEach(b->{
				Logger.verifyEquals(b.getAsJsonObject().get("autoMarkupStatus").getAsInt(), -1,"没有自动加价配置");
			});
			selectProductListDtos.forEach(b->{
				Logger.verifyEquals(b.getAutoMarkupStatus(), -1,"美有自动加价配置");
			});
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_25() {
		Logger.start(true, "查询支持快递和自提的商品");
		try {  
			int rootUserId=501465799;
			int agentUserId=501475678;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agentUserId, rootUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyNotEquals(selectionlistCall.getJsonObject().toString().indexOf(productId),-1,"选货中心中不包含仅支持自提的商品");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_26() {
		Logger.start(true, "仅支持自提的商品不会显示");
		try {
			int rootUserId=501465799;
			int agentUserId=501475678;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setExpressDelivery(false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agentUserId, rootUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyEquals(selectionlistCall.getJsonObject().toString().indexOf(productId),-1,"选货中心中不包含仅支持自提的商品");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_27() {
		Logger.start(true, "查询仅支持快递的商品");
		try {  
			int rootUserId=501465799;
			int agentUserId=501475678;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"",true);
			addAgentProductBean.setCollectionGoods(false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agentUserId, rootUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyNotEquals(selectionlistCall.getJsonObject().toString().indexOf(productId),-1,"选货中心中不包含仅支持自提的商品");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_28() {
		Logger.start(true, "vip二级代理查询上级自动加价配置");
		try {
			int vipRootUserId=500781768;
			int vipAgentUserId=500781769;
			int vipAgentUserId1=500781770;
			
			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(vipAgentUserId1, vipAgentUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			JsonArray asJsonArray = selectionlistCall.getJsonObject().getAsJsonObject("data").getAsJsonArray("productList");
			asJsonArray.forEach(b->{
				Logger.verifyEquals(b.getAsJsonObject().get("autoMarkupStatus").getAsInt(), 1,"有自动加价配置");
			});
			selectProductListDtos.forEach(b->{
				Logger.verifyEquals(b.getAutoMarkupStatus(), 1,"有自动加价配置");
			});
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_29() {
		Logger.start(true, "vip二级代理查询上级自动加价配置");
		try {

			int userId = 500949763;
			int AgentUserId = 500949764;
			int AgentUserId1 = 500949765;
			// 给渠道商创建一个商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(userId, "", false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(AgentUserId,"",productId,userId,false);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			Thread.sleep(5000);
			ProductDetailsBean initGetProductDetails1 = AddAgentProductCallService.initGetProductDetails(userId,
					AgentUserId1, agentProductId, true);
			ProductDetailsDto selectProductDetails1 = AddAgentProductCallService
					.GetProductDetailsCall(initGetProductDetails1);
			List<String> catalogs1 = new ArrayList<>();
			selectProductDetails1.getCatalogList().forEach(c -> {
				catalogs1.add(c.getCatalogId());
			});
			Thread.sleep(5000);
			// 代理商查询

			// 查看商品图片
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(AgentUserId1, AgentUserId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();

			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_30() {
		Logger.start(true, "一级代理，加上过滤条件，会从选货中心消失，取消过滤会出现");
		try {
			Integer MchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(MchId, 1);
            Integer AgentId = GodmchManageCallService.getAgentMchId(MchId, agenttype);
            //添加导入商品
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(MchId, "", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
			SaveSelectionConditionBean initSaveSelectionCondition = AddAgentProductCallService.InitSaveSelectionCondition(MchId, AgentId, 1);
			initSaveSelectionCondition.setBrandIdList(Arrays.asList(666));
			AddAgentProductCallService.SaveSelectionCondition(initSaveSelectionCondition);
			
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(AgentId,MchId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyEquals(0, selectionlistCall.getProductList().size(), "验证code");
			
			initSaveSelectionCondition = AddAgentProductCallService.InitSaveSelectionCondition(MchId, AgentId, 0);
			AddAgentProductCallService.SaveSelectionCondition(initSaveSelectionCondition);
			
			Thread.sleep(2000);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyEquals(productId, selectionlistCall.getProductList().get(0).getProductId(), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_31() {
		Logger.start(true, "渠道-》代理-》代理，加上过滤条件，会从选货中心消失，取消过滤会出现");
		try {
			//创建一个商户和分销小店
			Integer MchId = GodmchManageCallService.CreateGodMch();
			GodmchManageCallService.SetVip(MchId);
			Integer AgentId = GodmchManageCallService.CreateAgent(MchId);
			Integer AgentId1 = GodmchManageCallService.CreateAgent(AgentId,MchId);
			//创建商品，小店会继承
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(MchId, "", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(AgentId,"",productId,MchId,true);
			String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
			
			SaveSelectionConditionBean initSaveSelectionCondition = AddAgentProductCallService.InitSaveSelectionCondition(MchId, AgentId, 1);
			initSaveSelectionCondition.setBrandIdList(Arrays.asList(666));
			AddAgentProductCallService.SaveSelectionCondition(initSaveSelectionCondition);
			
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(AgentId1,AgentId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyEquals(0, selectionlistCall.getProductList().size(), "验证code");
			
			initSaveSelectionCondition = AddAgentProductCallService.InitSaveSelectionCondition(MchId, AgentId, 0);
			AddAgentProductCallService.SaveSelectionCondition(initSaveSelectionCondition);
			
			Thread.sleep(2000);
			selectionlistCall.callService();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyEquals(agentProductId, selectionlistCall.getProductList().get(0).getProductId(), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_33() {
		Logger.start(true, "渠道-》代理 。符合自动加价条件的，有标，不符合的没有标志");
		try {
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);
            
            createDepotBean bean=GodmchManageCallService.createDepot(mchId);
            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			
	        AddAgentProductBean addAgentProductBean1 = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
	        addAgentProductBean1.setCategoryId(1009);
			String productId1 = AddAgentProductCallService.AddAgentProduct(addAgentProductBean1);
				
			Thread.sleep(2000);
			setConditionMarkupConfigBean setConditionMarkupConfigBean = GodmchManageCallService.initDefSetConditionMarkupConfig(agent_mchId, mchId, 1, addAgentProductBean, 1);
			setConditionMarkupConfigBean.setOnSaleType(2);
            GodmchManageCallService.SetConditionMarkupConfigCall(setConditionMarkupConfigBean);
            
            Thread.sleep(2000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agent_mchId,mchId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			List<SelectProductListDto> productList = selectionlistCall.getProductList();
			Logger.verifyEquals(2, productList.size(), "查询出两个");
			productList.forEach(b->{
				Logger.verifyEquals(-1, b.getProductId().equals(productId)?1:-1, "验证自动加价配置");
			});
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_SelectionList_34() {
		Logger.start(true, "根据品牌和仓库查询商品列表");
		try {  
			Integer mchId = GodmchManageCallService.CreateGodMch();
            Integer agenttype=GodmchManageCallService.getAgentType(mchId, 1);
            Integer agent_mchId = GodmchManageCallService.getAgentMchId(mchId, agenttype);
            
			 createDepotBean bean=GodmchManageCallService.createDepot(mchId);
	            List<mch_depot_info> selectDepotByDepotTitle = GodmchManageCallService.SelectDepotByDepotTitle(bean.getDepotTitle());
	            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(mchId, "", true);
	            addAgentProductBean.setDepotId(selectDepotByDepotTitle.get(0).getDepotId());
				String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			selectionlistBean = AddAgentProductCallService.initSelectionListBean(agent_mchId, mchId);
			selectionlistCall.setData(selectionlistBean);
			selectionlistCall.callService();
			List<SelectProductListDto> selectProductListDtos = selectionlistCall.getProductList();
			Logger.verifyEquals("200", selectionlistCall.getString("code"), "验证code");
			Logger.verifyEquals(1,selectProductListDtos.size(),"选货中心中不包含仅支持自提的商品");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	

}